import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;

public class _06_RandomHandsOfFiveCards {

	public static void main(String[] args) {

		List<String> cards = new ArrayList<String>();

		String card = null;

		for (int suits = 1; suits <= 4; suits++)
        {
            for (int ranks = 1; ranks <= 13; ranks++)
            {
                switch (ranks)
                {
                    case 1: card = "A"; break;
                    case 2: card = "K"; break;
                    case 3: card = "Q"; break;
                    case 4: card = "J"; break;
                    case 5: card = "10"; break;
                    case 6: card = "9"; break;
                    case 7: card = "8"; break;
                    case 8: card = "7"; break;
                    case 9: card = "6"; break;
                    case 10: card = "5"; break;
                    case 11: card = "4"; break;
                    case 12: card = "3"; break;
                    case 13: card = "2"; break;
                }

                switch (suits)
                {
                    case 1: card += '♣'; break;
                    case 2: card += '♦'; break;
                    case 3: card += '♥'; break;
                    case 4: card += '♠'; break;
                }
                
                cards.add(card);
            }
        }

		Scanner inputCS = new Scanner(System.in);
		int numberOfHands = inputCS.nextInt();
		inputCS.close();

		for (int x = 0; x < numberOfHands; x++) {
			List<Integer> usedCards = new ArrayList<Integer>();

			Random randomGenerator = new Random();

			for (int i = 0; i < 5; i++) {

				int playCard = randomGenerator.nextInt(52);

				while (usedCards.contains(playCard)); {

					playCard = randomGenerator.nextInt(52);
				}

				usedCards.add(playCard);
			}
			
			String result = "";

			for (int i = 0; i < 5; i++) {

				result += cards.get(usedCards.get(i)) + " ";
			}

			System.out.println(result);
		}
	}
}